package day07;

import java.io.FileNotFoundException;
import java.io.RandomAccessFile;

public class Demo03 {

	public static void main(String[] args) throws Exception {
		String file="abc/abc.txt";
		RandomAccessFile raf=new RandomAccessFile(file,"rw");
		
		String str="你好ABC";

		
		byte[]b=str.getBytes("UTF-8");
		System.out.println(b.length);
		
		raf.write(b);
		long l=raf.getFilePointer();
		System.out.println(l);
		raf.seek(0);
	
		byte[]buf=new byte[9];
		raf.read(buf);
		String s=new String(buf,"UTF-8");
		System.out.println(s);
		raf.close();
		
		
		
//		raf.writeUTF(str);
//		raf.seek(0);
//		
//		String st=raf.readUTF();
//		System.out.println(st);
	
	}

}
